import {Injectable} from '@angular/core';
import {Router} from '@angular/router';

@Injectable({
    providedIn: 'root'
})
export class RouterService {

    constructor(private router: Router) {
    }

    navigate(path: string, queryParams?: any) {
        this.router.navigate([path], {queryParams: queryParams})
            .then(res => {
                console.log(`路由跳转成功`);
                console.log(res);
            })
            .catch(err => {
                console.warn(`路由跳转失败`);
                console.warn(err);
            });
    }
}
